package com.lzh.farmersshop.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lzh.farmersshop.mapper.OrderMapper;
import com.lzh.farmersshop.entity.Order;
import com.lzh.farmersshop.service.OrderService;
import com.lzh.farmersshop.util.Result;
import org.springframework.stereotype.Service;

import java.util.HashMap;

/**
 * (Order)表服务实现类
 *
 * @author makejava
 * @since 2024-01-04 15:37:11
 */
@Service("orderService")
public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements OrderService {

    @Override
    public Long getSalesVolumeByGoodsId(Integer id) {
        return baseMapper.getSalesVolumeByGoodsId(id);
    }

    @Override
    public Result selectAll(Order order, Integer page, Integer limit) {
        HashMap<String, Object> result = new HashMap<>();
        result.put("count",baseMapper.selectAllCount(order));
        result.put("data",baseMapper.selectAll(order,(page-1)*limit,limit));
        return Result.success(result);
    }
}

